function sqPolygon(p : array of point; k : longint) : double;

var
	i : longint;
	p1, p2 : point;

begin
	result := 0;
	if k < 3 then exit;
	for i := 1 to k do begin
		if i = 1 then p1 := p[k] else p1 := p[i - 1];
		p2 := p[i];
		result := result + (p1.x - p2.x) * (p1.y + p2.y);
	end;
	result := abs(result) / 2;
end;

function sqPol(p : array of pt; n : longint) : double;

var
  i : longint;
  
begin
  p[n + 1] := p[1];
  result := 0;
  for i := 2 to n do
    result := result + (p[1].x - p[i].x) * (p[1].y - p[i + 1].y) - (p[1].y - p[i].y) * (p[1].x - p[i + 1].x);
  result := abs(result) / 2;
end;